<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: drad
  Date: 2021/11/1
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>个人空间</title>
    <script src="${pageContext.request.contextPath}/resources/js/jquery-1.10.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css">
</head>
<style>
    /* Custom Styles */
    ul.nav-tabs {
        width: 140px;
        margin-top: 20px;
        border-radius: 4px;
        border: 1px solid #ddd;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.067);
    }

    ul.nav-tabs li {
        margin: 0;
        border-top: 1px solid #ddd;
    }

    ul.nav-tabs li:first-child {
        border-top: none;
    }

    ul.nav-tabs li a {
        margin: 0;
        padding: 8px 16px;
        border-radius: 0;
    }

    ul.nav-tabs li.active a,
    ul.nav-tabs li.active a:hover {
        color: #fff;
        background: #0088cc;
        border: 1px solid #0088cc;
    }

    ul.nav-tabs li:first-child a {
        border-radius: 4px 4px 0 0;
    }

    ul.nav-tabs li:last-child a {
        border-radius: 0 0 4px 4px;
    }

    ul.nav-tabs.affix {
        top: 30px;
        /* Set the top position of pinned element */
    }

    ul.nav-tabs li a:hover {
        cursor: pointer;
    }

    .img-circle {
        width: 100px;
        height: 100px !important;
        vertical-align: middle;
        margin-right: 10px;
    }

    .header {
        position: absolute;
        top: 0px;
        left: 0px;
        right: 0px;
        height: 60px;
        background-color: #337ab7;
        color: #fff;
    }

    .content {
        margin-top: 100px;
    }

    .greenbg {
        width: 100%;
        background-color: #337ab7;
    }

    .greenbr {
        text-align: center;
        border: solid;
        border-radius: 8px;
        border-color: #337ab7;
        color: #337ab7;
    }

    .submit {
        height: 45px;
    }

    .fit {
        width: 100%;
    }

    .row {
        margin-top: 10px;
    }

    .panel {
        width: 80%;
        margin: 0 auto;
        margin-bottom: 30px;
    }

    .box {
        margin-bottom: 20px;
    }

    .money-self {
        height: 40px !important;
        border: 0;
    }

    .div-self {
        padding: 0 !important;
    }

    .model-input {
        width: 100% !important;
    }
</style>
<body data-target="#myScrollspy">
<div class="container">
    <div class="jumbotron">
        <p><img src="http://192.168.2.149:9000/${sessionScope.user.pic}" alt="头像"
                class="img-circle img-thumbnail">亲爱的 ${sessionScope.user.nick}
            <button type="button" id="logout" class="btn btn-danger">登出</button>
        </p>
        <h1>漫币：${sessionScope.user.coin}</h1>
        <!-- Button trigger modal -->
        <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
            漫币充值
        </button>
        <a href="${pageContext.request.contextPath}/comics/index">返回主页</a>
    </div>
    <div class="row">
        <div class="col-xs-3" id="myScrollspy">
            <ul class="nav nav-tabs nav-stacked" data-spy="affix" data-offset-top="125">
                <c:forEach items="${sessionScope.userMenuList}" var="userMenu">
                    <li
                            <c:if test="${userMenu.menu == sessionScope.jsp}">
                                class="active"
                            </c:if>
                    ><a href="${pageContext.request.contextPath}/sys/user/person/${userMenu.menu}">${userMenu.note}</a>
                    </li>
                </c:forEach>
            </ul>
        </div>
        <div class="col-xs-9" id="main">
            <jsp:include page="${sessionScope.jsp}.jsp"/>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <div class="header text-center">
                        <h3>购买漫币</h3>
                    </div>
                </div>
                <div class="modal-body">
                    <div class="content">
                        <div class="panel">
                            <div class="row">
                                <div class="col-xs-5 greenbr money-div" style="background-color:#337ab7;color:#fff"
                                     data-value="10">
                                    <strong>10漫币</strong>
                                    <br> 售价：10.00元
                                </div>
                                <div class="col-xs-offset-2 col-xs-5 greenbr money-div" data-value="30">
                                    <strong>30漫币</strong>
                                    <br> 售价：30.00元
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-5 greenbr money-div" data-value="50">
                                    <strong>50漫币</strong>
                                    <br> 售价：50.00元
                                </div>
                                <div class="col-xs-offset-2 col-xs-5 greenbr money-div" data-value="100">
                                    <strong>100漫币</strong>
                                    <br> 售价：100.00元
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-5 greenbr money-div" data-value="300">
                                    <strong>300漫币</strong>
                                    <br> 售价：300.00元
                                </div>
                                <div class="col-xs-offset-2 col-xs-5 greenbr div-self">
                                    <input type="text" id="moneySelf" class="form-control money-self model-input"
                                           onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="自定义漫币数量">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <form id="recharge" action="${pageContext.request.contextPath}/sys/user/recharge" class="form panel" method="post">
                            <div class="form-group row box">
                                <label class="col-xs-3 control-label">用户ID</label>
                                <div class="col-xs-9">
                                    <input type="text" name="userId" class="form-control model-input" value="${sessionScope.user.id}"
                                           readonly>
                                </div>
                            </div>
                            <div class="form-group row box">
                                <label for="count" class="col-xs-3 control-label">金额</label>
                                <div class="col-xs-9">
                                    <input type="text" class="form-control model-input" id="count" name="count" readonly
                                           value="10">
                                </div>
                            </div>

                            <div class="form-group row box">
                                <div class="col-xs-12 fit">
                                    <button type="submit" class="btn btn-info fit">充值</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消充值</button>
                </div>
            </div>
        </div>
    </div>

</div>
</body>
<script>
    $('.money-div').click(function () {
        $('.money-div').css({"backgroundColor": "#fff", "color": "#337ab7"});
        $(this).css({"backgroundColor": "#337ab7", "color": "#fff"});
        $('#count').val($(this).data("value"));
        $('.money-self').val("")
    });
    $('.div-self').click(function () {
        $('.money-div').css({"backgroundColor": "#fff", "color": "#337ab7"});
        $(this).css({"backgroundColor": "#337ab7", "color": "#fff"});
        $('#count').val($('.money-self').val());
    });
    $('.money-self').bind('input', function () {
        $('#count').val($('.money-self').val().replace(/^(0+)|[^\d]+/g,''));
    });
    $('#recharge').submit(function () {
        alert("充值成功");
    });
    $('#logout').click(function () {
        window.location.href = "${pageContext.request.contextPath}/sys/user/logout";
    });
</script>
</html>
